<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:p="http://primefaces.prime.com.tr/ui">


<head>
<title>Rota Estatisctica - Pesquisa de Rota</title>
</head>

<body>

	<h3>Preencha as informações referentes à pesquisa de rota</h3>

	<h:form>

		<rich:messages globalOnly="true" infoStyle="color:blue"
			warnStyle="color:orange" errorStyle="color:red"
			fatalStyle="color:red"></rich:messages>

		<h:outputText value="*Campos obrigatórios"></h:outputText>
		<br></br>
		<h:panelGrid columns="4">


			<h:outputText value="*Linha"></h:outputText>

			<h:panelGroup>
				<h:selectOneMenu id="linha"
					value="#{pesquisaTrajetoView.idLinhaSelecionada}"
					valueChangeListener="#{pesquisaTrajetoView.selecionouLinha}"
					onchange="submit();" immediate="true">
					<f:selectItem itemLabel="Selecione" itemValue=""></f:selectItem>
					<f:selectItems value="#{pesquisaTrajetoView.linhas}"></f:selectItems>
					<a4j:support event="onchange"
						reRender="regionEstacaoOrigem, regionEstacaoDestino"
						immediate="true"></a4j:support>
				</h:selectOneMenu>

			</h:panelGroup>

			<h:outputText value="Dia da Semana"></h:outputText>

			<h:panelGroup>
				<h:selectOneMenu id="diaDaSemana"
					value="#{pesquisaTrajetoView.diaDaSemanaSelecionado}">
					<f:selectItem itemLabel="Selecione" itemValue=""></f:selectItem>
					<f:selectItems value="#{pesquisaTrajetoView.diasDaSemana}"></f:selectItems>
				</h:selectOneMenu>

			</h:panelGroup>


			<h:outputText value="*Origem"></h:outputText>



			<h:panelGroup>
				<a4j:region id="regionEstacaoOrigem">
					<h:selectOneMenu id="estacaoOrigem"
						value="#{pesquisaTrajetoView.idEstacaoOrigemSelecionada}">
						<f:selectItem itemLabel="Selecione" itemValue=""></f:selectItem>
						<f:selectItems
							value="#{pesquisaTrajetoView.estacoesDaLinhaSelecionada}"></f:selectItems>
					</h:selectOneMenu>
				</a4j:region>

			</h:panelGroup>


			<h:outputText value="*Destino"></h:outputText>

			<h:panelGroup>
				<a4j:region id="regionEstacaoDestino">
					<h:selectOneMenu id="estacaoDestino"
						value="#{pesquisaTrajetoView.idEstacaoDestinoSelecionada}">
						<f:selectItem itemLabel="Selecione" itemValue=""></f:selectItem>
						<f:selectItems
							value="#{pesquisaTrajetoView.estacoesDaLinhaSelecionada}"></f:selectItems>
					</h:selectOneMenu>
				</a4j:region>

			</h:panelGroup>


			<h:outputText value="Lotação"></h:outputText>

			<h:panelGroup>
				<h:selectOneMenu id="lotacao"
					value="#{pesquisaTrajetoView.idLotacaoSelecionada}">
					<f:selectItem itemLabel="Selecione" itemValue=""></f:selectItem>
					<f:selectItems value="#{pesquisaTrajetoView.lotacoes}"></f:selectItems>
				</h:selectOneMenu>
				<rich:message for="lotacao" style="color:red" />
			</h:panelGroup>


			<h:outputText value="Clima"></h:outputText>

			<h:panelGroup>
				<h:selectOneMenu id="clima"
					value="#{pesquisaTrajetoView.idClimaSelecionado}">
					<f:selectItem itemLabel="Selecione" itemValue=""></f:selectItem>
					<f:selectItems value="#{pesquisaTrajetoView.climas}"></f:selectItems>
				</h:selectOneMenu>
				<rich:message for="clima" style="color:red" />
			</h:panelGroup>
		</h:panelGrid>

		<br></br>

		<h:panelGrid columns="2">
			<h:outputText value="Intervalo de Horas"></h:outputText>
			<h:outputText value=""></h:outputText>


			<h:outputText value="Horário Inicio"></h:outputText>
			<h:panelGroup>
				<h:selectOneMenu id="horaInicio"
					value="#{pesquisaTrajetoView.horaInicioSelecionada}">
					<f:selectItem itemLabel="Selecione" itemValue=""></f:selectItem>
					<f:selectItems value="#{pesquisaTrajetoView.horas}"></f:selectItems>
				</h:selectOneMenu>
			</h:panelGroup>

			<h:outputText value="Horário Fim"></h:outputText>
			<h:panelGroup>
				<h:selectOneMenu id="horaFim"
					value="#{pesquisaTrajetoView.horaFimSelecionada}">
					<f:selectItem itemLabel="Selecione" itemValue=""></f:selectItem>
					<f:selectItems value="#{pesquisaTrajetoView.horas}"></f:selectItems>
				</h:selectOneMenu>
			</h:panelGroup>
		</h:panelGrid>
		<br></br>

		<h:panelGrid columns="4">
			<h:outputText value="Intervalo de Datas"></h:outputText>
			<h:outputText value=""></h:outputText>
			<h:outputText value=""></h:outputText>
			<h:outputText value=""></h:outputText>

			<h:outputText value="Data Inicio"></h:outputText>
			<h:panelGroup>
				<a4j:outputPanel layout="block">
					<rich:calendar id="dataInicio"
						value="#{pesquisaTrajetoView.dataInicioSelecionada}" locale="BR"
						popup="true" datePattern="dd/MM/yyyy" showApplyButton="true"
						cellWidth="24px" cellHeight="22px" style="width:200px">
					</rich:calendar>
				</a4j:outputPanel>

			</h:panelGroup>

			<h:outputText value="Data Fim"></h:outputText>
			<h:panelGroup>
				<a4j:outputPanel layout="block">
					<rich:calendar id="dataFim"
						value="#{pesquisaTrajetoView.dataFimSelecionada}" locale="BR"
						popup="true" datePattern="dd/MM/yyyy" showApplyButton="true"
						cellWidth="24px" cellHeight="22px" style="width:200px">
					</rich:calendar>
				</a4j:outputPanel>

			</h:panelGroup>
		</h:panelGrid>
		<br></br>



		<h:panelGrid columns="2">
			<h:commandButton value="Pesquisar"
				action="#{pesquisaTrajetoView.pesquisar}"></h:commandButton>
			<h:commandButton value="Home" action="HOME"></h:commandButton>
		</h:panelGrid>

		<br></br>
		<br></br>

		<h:panelGrid columns="1">
			<b><h:outputText value="Dados Estatísticos referente à Pesquisa"
					rendered="#{pesquisaTrajetoView.mostrarDados}" /> </b>
			<hr />
		</h:panelGrid>



		<h:panelGrid columns="5" border="1"
			rendered="#{pesquisaTrajetoView.mostrarDados}">

			<h:outputText value="Amostra" />

			<h:outputText value="Média De Tempo" />

			<h:outputText value="Tempo Máximo" />

			<h:outputText value="Tempo Mínimo" />

			<h:outputText value="Desvio Padrão" />

			<h:outputText value="#{pesquisaTrajetoView.amostra}" />
			<h:outputText value="#{pesquisaTrajetoView.tempoMedio}" />
			<h:outputText value="#{pesquisaTrajetoView.tempoMax}" />
			<h:outputText value="#{pesquisaTrajetoView.tempoMin}" />
			<h:outputText value="#{pesquisaTrajetoView.desvioPadrao}" />

		</h:panelGrid>


	</h:form>

</body>
</html>